﻿function random(min, max) {
    return Math.floor(Math.random() * (max - min + 1)) + min;
}

function responseGenerator(responseHandler, participantCount) {
    var deviceIDs = new Array(participantCount);
    for (var i = 0; i < participantCount; i++) {
        deviceIDs[i] = (i + 800000).toString(16).toUpperCase();
    }
    window.setInterval(function() {
        var deviceID = deviceIDs[random(0, participantCount - 1)];
        var response = random(1, 9);
        responseHandler("0" + deviceID, response);
    }, 1000);
}